<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ page isELIgnored="false" %>
<% request.setCharacterEncoding("UTF-8");
  

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jQuery EasyUI:Update Pages</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js" ></script>
<script type="text/javascript" src="js/team.js"></script>
<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css" />


<script type="text/javascript">

			$(function () {
			
			
            
		
			$('#left').combobox({ 
			     
			   url:'http://localhost:8080/Sorrow/euroteam.do',    
			    valueField:'id',     
			    textField:'team',
			    groupField : 'gender',
                groupFormatter: function(group){
                return '<span style="color:red">' + group + '</span>';
                },
                
                filter: function(q, row){
				var opts = $(this).combobox('options');
				return row[opts.textField].indexOf(q) >= 0;
				},
				formatter: function(row){
				var opts = $(this).combobox('options');
				return '[' + row[opts.textField] + ']';
				},
			    
			    //加载城市
			   onHidePanel:function (){ //当面板隐藏时触发 combox的方法写在combox体内（即$('#sheng').combobox({ })内部)
		       var flag = $("#left").combobox('getText');
		        //alert(flag);
		       var temp = $("#right").combobox('getText');
		       //alert(temp);
		       if(temp !== 'check team'){
		        	$('#box').datagrid({
					
					     url : "http://localhost:8080/Sorrow/vsone.do?teamright="+temp+"&teamleft="+flag
					});
		       }else{
			   $.ajax({
               type: "GET",
               url: "http://localhost:8080/Sorrow/union.do?team="+flag+"&page=1&rows=20",
           
               dataType: "json",
               success: function(data){
                       
                     	$('#box').datagrid({
					
					     url : "http://localhost:8080/Sorrow/union.do?team="+flag+""
					});
			
				

			if(data == null){
				$('#box').datagrid('loadData',{ total: 0, rows: [] });
				$.messager.show({
				title: 'Error',
				msg: "No record checked!!"
				});
			}
                      }
             });
            }
		  
		   }	
			});  
			
			//初始化县
			
             
             
             $('#right').combobox({ 
			     
			    url:'http://localhost:8080/Sorrow/euroteam.do',
			    valueField:'id',     
			    textField:'team',
			    
			    onHidePanel:function (){ //当面板隐藏时触发 combox的方法写在combox体内（即$('#sheng').combobox({ })内部)
		       var flag = $("#right").combobox('getText');
		      // alert(flag);
		       var temp = $("#left").combobox('getText');
		      // alert(temp);
		       if(temp !== 'check team'){
		        	$('#box').datagrid({
					
					     url : "http://localhost:8080/Sorrow/vsone.do?teamright="+flag+"&teamleft="+temp
					});
		       }else{
			 $.ajax({
             type: "GET",
             url: "http://localhost:8080/Sorrow/union.do?team="+flag+"&page=1&rows=20",
           
             dataType: "json",
             success: function(data){
                        
                     	$('#box').datagrid({
					
					     url : "http://localhost:8080/Sorrow/union.do?team="+flag+""
					});
			
				

			if(data == null){
				$('#box').datagrid('loadData',{ total: 0, rows: [] });
				$.messager.show({
				title: 'Error',
				msg: "No record checked!!"
				});
			}
                      }
             });
            }
		  
		   }	
			});  
			
			
				$('#round').combobox({ 
			     
			   url:'http://localhost:8080/Sorrow/ground.do',    
			    valueField:'id',     
			    textField:'round',
			    groupField : 'gender',
                groupFormatter: function(group){
                return '<span style="color:red">' + group + '</span>';
                },
                
                filter: function(q, row){
				var opts = $(this).combobox('options');
				return row[opts.textField].indexOf(q) >= 0;
				},
				formatter: function(row){
				var opts = $(this).combobox('options');
				return '[' + row[opts.textField] + ']';
				},
			    
			    //加载城市
			   onHidePanel:function (){ //当面板隐藏时触发 combox的方法写在combox体内（即$('#sheng').combobox({ })内部)
		       var flag = $("#round").combobox('getText');
		        //alert(flag);
		      
		     
			   $.ajax({
               type: "GET",
               url: "http://localhost:8080/Sorrow/round.do?round="+flag+"&page=1&rows=20",
           
               dataType: "json",
               success: function(data){
                       
                     	$('#box').datagrid({
					
					     url : "http://localhost:8080/Sorrow/round.do?round="+flag
					});
			
				

			if(data == null){
				$('#box').datagrid('loadData',{ total: 0, rows: [] });
				$.messager.show({
				title: 'Error',
				msg: "No record checked!!"
				});
			}
                      }
             });
           
		  
		   }	
			});  
             
            
		
	}); 
		
		</script>

</head>
<body>

   


   
<div align="center"><br><br><br>
<table id="box"></table></div>
<!--
<table id="dg" title="My Users" class="easyui-datagrid" style="width:550px;height:250px"
		url="get_users.php"
		toolbar="#toolbar"
		rownumbers="true" fitColumns="true" singleSelect="true">
	<thead>
		<tr>
			<th field="firstname" width="50">First Name</th>
			<th field="lastname" width="50">Last Name</th>
			<th field="phone" width="50">Phone</th>
			<th field="email" width="50">Email</th>
		</tr>
	</thead>
</table>
-->

<div id="toolbar">
    <table bgcolor="purple" width="100%">
<tr> 
<td width="2"></td><td text-algin="right" width="23"><div algin="right"><img src="img/sea.jpg"  height="50" onclick = 'hrefto()' ></img></div></td><td width="2"></td><td text-algin="left"><strong><font size='3' color="skyblue">Surfing Schedule Info</font></strong></td>
</tr>
</table>
<hr/>

<hr/>
<br/>
    <a href="#" class="easyui-linkbutton" iconCls="icon-print" plain="true" onclick="reborn()"><strong>重新随机生成新的赛程表</strong></a>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong></strong><input type="text" id="left" value="check team"/>
   &nbsp;<strong>VS</strong>&nbsp;<input type="text" id="right" value="check team" />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>轮次赛程查看：</strong><input type="text" id="round" value="check round" />
			
	
	
</div>

<div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"
		closed="true" buttons="#dlg-buttons">
	<div align="center" class="ftitle"><strong><font size="3">User Information</strong></div>
	<form id="fm" method="post" accept-charset="utf-8" onsubmit="document.charset='utf-8';" >
	    <br><br><br>
		<div align="center" class="fitem">
			<strong>TeamName:</strong>
			<input id="fmteamname" name="firstname" class="easyui-validatebox" required="true">
		</div><br>
		<div align="center" class="fitem">
			<strong>TeamNumb:</strong>
			<input id="fmteamnum" name="lastname" class="easyui-validatebox" required="true">
		</div>
	</form>
</div>
<div id="dlg-buttons">
	<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()">Save</a>
	<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>
</div>

</body>
</html>